Tailwind CSS 4.1 Three-Column Full Screen Layout
To achieve a three-column layout that fills the entire page height, we need to ensure both the outer container and each column have 100% height. In Tailwind CSS 4.1, follow these steps:
- Set the root elements ( - html,- body) to- height: 100%to allow subsequent elements to expand based on viewport height.
- Use flexbox layout with the outer container (flex container) set to viewport height ( - h-screen).
- Configure three flex columns: fixed-width left/right columns, a fluid center column, and automatic height stretching (default - align-items: stretchensures equal height).
Core Code:
  
  
  Full Height Three Columns 
  
  
  
    
    
      Fixed width (256px)
    
    
    
    
      Fluid width
    
    
    
    
      Fixed width (256px)
    
  
Implementation Principles:
- Set root elements to 100% height: - h-fullclass (equivalent to- height: 100%) makes the body fill the viewport height.
- Outer container settings: - flex: Enables flexbox layout
- h-screen: Sets container height to viewport height (100vh)
 
- Column height behavior: Flexbox's default - align-items: stretchautomatically expands column heights to match the container's height (full screen). No manual height required.
- Fixed-width columns: - w-64: Fixed width of 256px
- shrink-0: Prevents column shrinkage when space is limited
 
- Fluid center column: - flex-1: Occupies all remaining available space
Important Notes:
- If content exceeds a column's height: Columns will expand (due to - align-items: stretch), causing scrollbars. For internal scrolling, add- overflow-autoto a nested container within the column.
- For non-fullscreen layouts: Ensure the parent container has explicit height, then set the layout container to - flex h-fullto inherit the parent's height.
